import xlwt
strfdirArr = ["57", "58", "59", "60", "61"]
strfileArr = ["2018-12-29", "2018-12-30", "2018-12-31", "2019-01-01", "2019-01-02", "2019-01-03"]

for filedir in strfdirArr:
    for filename in strfileArr:
        file = open('log/'+filedir+'/access.'+filename+'.log', 'r')
        f = xlwt.Workbook() #创建工作簿
        i = 0
        sheet1 = f.add_sheet(u''+filename+'', cell_overwrite_ok=True) #创建sheet
        while True:
            mystr = file.readline()
            if not mystr:
                break
            if mystr.find("/_ui/responsive") < 0:
               # print(mystr[22:36], end="\n")
                sheet1.write(i, 0, mystr[22:36])
                sheet1.write(i, 1, 1)
                i = i + 1
        f.save('logexcel/'+filedir+'/'+filename+'.xls')


